package com.example.system.dto;

import com.example.starter.webmvc.valid.CreateValid;
import com.example.starter.webmvc.valid.UpdateValid;
import lombok.Data;
import lombok.experimental.Accessors;

import javax.validation.constraints.*;
import java.io.Serializable;
import java.util.List;

/**
 *
 * @author 王令
 * @since 2022-08-05
 */
@Data
@Accessors(chain = true)
public class UserDto implements Serializable {

    private static final long serialVersionUID = 1L;

    @NotNull(message = "id不能为空", groups = {UpdateValid.class})
    private Long id;

    /**
     * 租户id
     */
    private String tenantId;

    /**
     * 用户名
     */
    @NotBlank(message = "用户名不能为空", groups = {CreateValid.class, UpdateValid.class})
    @Size(min = 3, max = 16, message = "用户名长度在3-16位之间")
    private String username;

    /**
     * 昵称
     */
    @Size(max = 16, message = "昵称长度不能超过16位", groups = {UpdateValid.class, CreateValid.class})
    private String nickname;

    /**
     * 密码
     */
    @NotBlank(message = "密码不能为空", groups = {CreateValid.class})
    @Size(min = 4, max = 16, message = "密码长度在4-16位之间", groups = {CreateValid.class})
    private String password;

    /**
     * 性别
     */
    private Integer gender;

    /**
     * 手机号
     */
    @NotBlank(message = "手机号不能为空", groups = {CreateValid.class, UpdateValid.class})
    private String phone;

    /**
     * 邮箱
     */
    @Email(message = "邮箱不合法")
    private String email;

    /**
     * 头像url
     */
    private String avatar;

    /**
     * 角色
     */
    @NotEmpty(message = "角色不能为空", groups = {CreateValid.class, UpdateValid.class})
    private List<Long> rolesId;

    private List<Long> deptsId;

    /**
     * 锁定
     */
    private Boolean nonLocked;

    /**
     * 状态
     */
    private Boolean enabled;

}
